package pl.cvplus.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.sql.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_experience", schema = "public", catalog = "")
@Entity
public class CpExperience {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private String companyName;

    @javax.persistence.Column(name = "company_name", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    private String workPosition;

    @javax.persistence.Column(name = "work_position", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getWorkPosition() {
        return workPosition;
    }

    public void setWorkPosition(String workPosition) {
        this.workPosition = workPosition;
    }

    private String responsibilities;

    @javax.persistence.Column(name = "responsibilities", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getResponsibilities() {
        return responsibilities;
    }

    public void setResponsibilities(String responsibilities) {
        this.responsibilities = responsibilities;
    }

    private Date startDate;

    @javax.persistence.Column(name = "start_date", nullable = true, insertable = true, updatable = true, length = 13, precision = 0)
    @Basic
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    private Date endDate;

    @javax.persistence.Column(name = "end_date", nullable = true, insertable = true, updatable = true, length = 13, precision = 0)
    @Basic
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    private Boolean stillWorking;

    @javax.persistence.Column(name = "still_working", nullable = true, insertable = true, updatable = true, length = 1, precision = 0)
    @Basic
    public Boolean getStillWorking() {
        return stillWorking;
    }

    public void setStillWorking(Boolean stillWorking) {
        this.stillWorking = stillWorking;
    }

    private Integer cvFk;

    @javax.persistence.Column(name = "cv_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getCvFk() {
        return cvFk;
    }

    public void setCvFk(Integer cvFk) {
        this.cvFk = cvFk;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpExperience that = (CpExperience) o;

        if (companyName != null ? !companyName.equals(that.companyName) : that.companyName != null) return false;
        if (cvFk != null ? !cvFk.equals(that.cvFk) : that.cvFk != null) return false;
        if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) return false;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (responsibilities != null ? !responsibilities.equals(that.responsibilities) : that.responsibilities != null)
            return false;
        if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != null) return false;
        if (stillWorking != null ? !stillWorking.equals(that.stillWorking) : that.stillWorking != null) return false;
        if (workPosition != null ? !workPosition.equals(that.workPosition) : that.workPosition != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (companyName != null ? companyName.hashCode() : 0);
        result = 31 * result + (workPosition != null ? workPosition.hashCode() : 0);
        result = 31 * result + (responsibilities != null ? responsibilities.hashCode() : 0);
        result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
        result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
        result = 31 * result + (stillWorking != null ? stillWorking.hashCode() : 0);
        result = 31 * result + (cvFk != null ? cvFk.hashCode() : 0);
        return result;
    }

    private CpCv cpCvByCvFk;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "cv_fk", referencedColumnName = "id")
    CpCv getCpCvByCvFk() {
        return cpCvByCvFk;
    }

    public void setCpCvByCvFk(CpCv cpCvByCvFk) {
        this.cpCvByCvFk = cpCvByCvFk;
    }
}
